import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: '/home/dashboard'
    },
    {
      path: '/home',
      name: 'home',
      component: Home,
      meta: {
        title: 'Home'
      },
      children: [
        {
          path: 'dashboard',
          name: 'dashboard',
          component: () => import('@/views/sub/Dashboard.vue'),
          meta: {
            title: '首页'
          }
        },
        {
          path: 'dept',
          name: 'dept',
          component: () => import('@/views/sub/Dept.vue'),
          meta: {
            title: '部门管理'
          }
        },
        {
          path: 'emp',
          name: 'emp',
          component: () => import('@/views/sub/Emp.vue'),
          meta: {
            title: '员工管理'
          }
        },
        {
          path: 'system',
          name: 'system',
          component: () => import('@/views/sub/System.vue'),
          meta: {
            title: '系统管理'
          }
        }
      ]
    },
  ],
})

export default router
